/**
 * Copyright (C) 2011  E-Robot
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 * @brief Map.h
 *
 * @date 21 nov. 2010
 * @author elca
 * @version 0.1
 */

#ifndef MAP_H_
#define MAP_H_

#include <qgraphicsscene.h>
#include "Cell.h"
#include <qmutex.h>
class Map: public QGraphicsScene
{
	Q_OBJECT
public:
	Map(int _nbrCellWidth, int _nbrCellHeight, int _size,int _resolution = 1);
	virtual ~Map();

	virtual void keyPressEvent ( QKeyEvent * event );

	int getX(double _x);
	int getY(double _y);

	public Q_SLOTS:
		virtual void updateCell(QLineF _line)=0;

	Q_SIGNALS:
		void changeMask(int _mask);
		void resetMap();
		void changeAlgo();

	protected:
		QList<QGraphicsItem*> axe;
		QVector<QVector<Cell*> > cells;

		QMutex mut;

		int width;
		int height;

		int size;
		int resolution;

		//Millieu tableau
		double mX,mY;

		//Nombre de cellule
		int nbCellHeight, nbCellWidth ;

		//Scene rect
		int xScene;
		int yScene ;
		int widthScene;
		int heightScene;
};

#endif /* MAP_H_ */
